﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameFacade{
    /// <summary>
    /// 单例模式：
    /// 1.私有化变量 内部进行实例化
    /// 2.构造方法私有化
    /// 3.提供唯一公有方法给外部访问
    /// </summary>
    private static GameFacade _instance = new GameFacade();
    public static GameFacade Instance
    {
        get { return _instance; }
    }


    private bool m_isGameOver = false;

    //私有化构造方法
    private GameFacade() { }

    private GameEventSystem m_gameEventSystem;
    private CampSystem m_campSystem;
    private StageSystem m_stageSystem;
    private CharacterSystem m_characterSystem;
    private APSystem m_apSystem;
    private AchievementSystem m_achievementSystem;


    private CampInfoUI m_campInfoUI;
    private SoldierInfoUI m_soldierInfoUI;
    private GameStateInfoUI m_gameStateInfoUI;
    private GamePauseUI m_gamePauseUI;

    public void Init()
    {
        m_achievementSystem = new AchievementSystem();
        m_apSystem = new APSystem();
        m_campInfoUI = new CampInfoUI();
        m_campSystem = new CampSystem();
        m_characterSystem = new CharacterSystem();
        m_gameEventSystem = new GameEventSystem();
        m_gamePauseUI = new GamePauseUI();
        m_gameStateInfoUI = new GameStateInfoUI();
        m_soldierInfoUI = new SoldierInfoUI();
        m_stageSystem = new StageSystem();

        m_achievementSystem.Init();
        m_apSystem.Init();
        m_campInfoUI.Init();
        m_campSystem.Init();
        m_characterSystem.Init();
        m_gameEventSystem.Init();
        m_gamePauseUI.Init();
        m_gameStateInfoUI.Init();
        m_soldierInfoUI.Init();
        m_stageSystem.Init();
        
    }
    public void Update()
    {
        m_achievementSystem.Update();
        m_apSystem.Update();
        m_campInfoUI.Update();
        m_campSystem.Update();
        m_characterSystem.Update();
        m_gameEventSystem.Update();
        m_gamePauseUI.Update();
        m_gameStateInfoUI.Update();
        m_soldierInfoUI.Update();
        m_stageSystem.Update();
    }
    public void Release()
    {
        m_achievementSystem.Release();
        m_apSystem.Release();
        m_campInfoUI.Release();
        m_campSystem.Release();
        m_characterSystem.Release();
        m_gameEventSystem.Release();
        m_gamePauseUI.Release();
        m_gameStateInfoUI.Release();
        m_soldierInfoUI.Release();
        m_stageSystem.Release();
    }

    /// <summary>
    /// 判断游戏是否结束
    /// </summary>
    public bool isGameOver
    {
        get { return m_isGameOver; }
    }

    /// <summary>
    /// I think this method is supposed to be put in CampSystem;
    /// </summary>
    public Vector3 GetSoldierCampPosition
    {
        get { return Vector3.zero; }
    }
	//关卡系统 角色管理系统 成就系统
}
